package cn.com.ejiakanghu.vo;

import org.linlinjava.litemall.db.domain.AgedmallSupportAftersale;
import org.linlinjava.litemall.db.domain.LitemallOrderGoods;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class AfterSaleAServiceSuportRefundVo {
    private Integer active;
    private BigDecimal price;
    private String priceDesc;
    private List<AfterSaleAServiceSuportRefundReasonVo> reasonList;
    private AfterSaleAServiceSuportRefundUpDoorVo upDoor;

    public static AfterSaleAServiceSuportRefundVo getInstance(AgedmallSupportAftersale supportAftersale, BigDecimal price, String priceDesc) {
        AfterSaleAServiceSuportRefundVo suportRefundVo = new AfterSaleAServiceSuportRefundVo();
        suportRefundVo.setActive(1);
        suportRefundVo.setPrice(price);
        suportRefundVo.setPriceDesc(priceDesc);
        String[] reason = supportAftersale.getReason();
        List<AfterSaleAServiceSuportRefundReasonVo> reasonList = Arrays.stream(reason).map(AfterSaleAServiceSuportRefundReasonVo::new).collect(Collectors.toList());
        suportRefundVo.setReasonList(reasonList);
        AfterSaleAServiceSuportRefundUpDoorVo upDoor = new AfterSaleAServiceSuportRefundUpDoorVo(supportAftersale.getUpdoorPrice(), supportAftersale.getUpdoorPricedesc());
        suportRefundVo.setUpDoor(upDoor);
        return suportRefundVo;
    }

    public AfterSaleAServiceSuportRefundVo(Integer active, BigDecimal price, String priceDesc, List<AfterSaleAServiceSuportRefundReasonVo> reasonList, AfterSaleAServiceSuportRefundUpDoorVo upDoor) {
        this.active = active;
        this.price = price;
        this.priceDesc = priceDesc;
        this.reasonList = reasonList;
        this.upDoor = upDoor;
    }

    public AfterSaleAServiceSuportRefundVo(Integer active, BigDecimal price, String priceDesc, List<AfterSaleAServiceSuportRefundReasonVo> reasonList) {
        this.active = active;
        this.price = price;
        this.priceDesc = priceDesc;
        this.reasonList = reasonList;
    }

    public AfterSaleAServiceSuportRefundVo() {
    }

    public Integer getActive() {
        return active;
    }

    public void setActive(Integer active) {
        this.active = active;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getPriceDesc() {
        return priceDesc;
    }

    public void setPriceDesc(String priceDesc) {
        this.priceDesc = priceDesc;
    }

    public List<AfterSaleAServiceSuportRefundReasonVo> getReasonList() {
        return reasonList;
    }

    public void setReasonList(List<AfterSaleAServiceSuportRefundReasonVo> reasonList) {
        this.reasonList = reasonList;
    }

    public AfterSaleAServiceSuportRefundUpDoorVo getUpDoor() {
        return upDoor;
    }

    public void setUpDoor(AfterSaleAServiceSuportRefundUpDoorVo upDoor) {
        this.upDoor = upDoor;
    }
}
